Dart SDK Target

The Target class provides a way to define settings and behaviors that are specific to each compilation target (such as web, mobile, server).

This allows Dart to be truly cross-platform, enabling the same codebase to be compiled and run effectively in different environments.

Each target has a unique name, identifying the specific platform or configuration it represents (e.g., iOS, Android, Web).

A global Map targets in pkg/kernel/lib/target/targets.dart contains all the targets:

final Map<String, _TargetBuilder> targets = <String, _TargetBuilder>{
  'none': (TargetFlags flags) => new NoneTarget(flags),
};

In the compilation process, installAdditionalTargets(tool/_fasta/additional_targets.dart:20) will set all the supported targets.

Note: installAdditionalTargets is also the first of the compilation, so finding its usage will get all the compiling methods in the Dart SDK.

Library Management

All the Targets


本文作者:Maeiee

本文链接:Dart SDK Target

版权声明:如无特别声明,本文即为原创文章,版权归 Maeiee 所有,未经允许不得转载!


喜欢我文章的朋友请随缘打赏,鼓励我创作更多更好的作品!